
#include <iostream>
#include <cstring>
#include "btnode.h"

using namespace std;

#define parse_cla(str) (strcmp(argv[i], str) == 0)

void print_usage(void) 
{
	cout << endl;
	cout << "Usage: binarytree [options...]" << endl << endl;
	cout << "To visualize binary tree enter few numbers ending with -1." << endl; 
	cout << "Example Input: 5 4 6 3 7 2 8 1 9 10 -1" << endl << endl;
	cout << "Options:"<<endl;
	cout << "--simple	Simulate simple binary search tree." << endl;
	cout << "--rb 		Simulate Red-Black binary search tree." << endl;
	cout << "-h, --help Display this help information and exit."<<endl;
	cout << endl;

	exit(-1);
}

/* Process command line options. */
void process_arguments(int argc, char * argv[], BinaryTreeType& tree_type)
{
	/* Parse the argument */
	if(argc == 1)
		print_usage();

	for(int i = 1; i < argc; i++) {

		if(parse_cla("--help") || parse_cla("-h"))
			print_usage();
		if(parse_cla("--simple"))
			tree_type = SIMPLE;
		else if(parse_cla("--rb"))
			tree_type = REDBLACK;
		else 
			print_usage();
	}
}


